
#include "communication.h"
#include <stdlib.h>


void readflashAndInitxn(void)
{
    static numberrand;
    memcpy(pXn297l->address, pFlashData->address, 5);
    
    if((pXn297l->address[0]==0xff)&&\
    (pXn297l->address[1]==0xff)&&\
    (pXn297l->address[2]==0xff)&&\
    (pXn297l->address[3]==0xff)&&\
    (pXn297l->address[4]==0xff))
    {
        numberrand=rand();
        pXn297l->address[0] =numberrand;
        pXn297l->address[1] =++numberrand;
        pXn297l->address[2] =++numberrand;
        pXn297l->address[3] =++numberrand;
        pXn297l->address[4] =++numberrand;

        /**********
        //使用新地址 这里地址应该是保存但是不切换的,后面对频的时候再用
        xn297lWriteBuf(W_REGISTER + TX_ADDR, pXn297l->address, 5);
        xn297lWriteBuf(W_REGISTER + RX_ADDR_P0,pXn297l->address, 5);
        *********/
    }
}
